package com.bw.a1908.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.bumptech.glide.Glide;
import com.bw.a1908.R;
import com.bw.a1908.bean.VideoBean;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public class VideoCardAdapter extends BaseQuickAdapter<VideoBean, BaseViewHolder> {
    public VideoCardAdapter(@Nullable List<VideoBean> data) {
        super(R.layout.item_video, data);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, VideoBean videoBean) {
        Glide.with(getContext()).load(videoBean.headpath).into((ImageView) baseViewHolder.getView(R.id.item_avatar_iv));

        View coverIv = baseViewHolder.getView(R.id.item_img_iv);
        LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) coverIv.getLayoutParams();
        params.height = videoBean.height;
        coverIv.setLayoutParams(params);
        Glide.with(getContext()).load(videoBean.videomainimg).into((ImageView) coverIv);

        baseViewHolder.setText(R.id.item_text_tv,videoBean.authname);
    }
}
